package com.cyanite.playlv2api.parsers.json;

import com.cyanite.playlv2api.types.TaskMini;

import org.json.JSONException;
import org.json.JSONObject;

public class TaskMiniParser extends AbstractParser<TaskMini> {

    @Override
    public TaskMini parse(JSONObject json) throws JSONException {
        TaskMini obj = new TaskMini();
        if (json.has("sid")) {
            obj.setId(json.getString("sid"));
        }
        if (json.has("type")) {
            obj.setType(json.getInt("type"));
        }
        if (json.has("info")) {
            obj.setInfo(new InfoParser().parse(json.getJSONObject("info")));
        }

        return obj;
    }
}